<?php
class Controller_Admin_Splash extends Controller_Form
{
    public function __construct ($req, $res)
    {
        parent::__construct($req, $res);
        $this->template = 'smarty:admin/system/splash';
    }

    public function action_index ()
    {
        $post = $this->request->post();
        if (empty($post))
        {
            $url = App_Splash::currentImageUrl();
            $this->template->set('imageUrl', $url);
        }
        else
        {
            list($url, $pos) = Media::upload(Kohana::config('env.image.splash'));
            App_Splash::setCurrentImageUrl($url);
            $this->request->redirect('/admin/splash');
        }
    }
}
